package note1.chapters.chapterb;

import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.ListIterator;

public class ListIteratorTest {

	public static void main(String[] args) {
		List<Integer> il = new ArrayList<Integer>(Arrays.asList(1, 2, 3, 4));
		List<Integer> il2 = new ArrayList<Integer>();
		ListIterator<Integer> li = il.listIterator(il.size());
		while (li.hasPrevious()) {
			System.out.println(li.previousIndex() + ":" + li.nextIndex());
			Integer integer = li.previous();
			il2.add(integer);
		}
		System.out.println(il2);
		// Stack<E>
	}

}
